package com.dmooo.ymx.merchantadapter;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.dmooo.ymx.MainActivity;
import com.dmooo.ymx.R;
import com.dmooo.ymx.config.Constants;
import com.dmooo.ymx.merchantbean.MerchantGroupbean;
import com.dmooo.ymx.widget.CircleImageView;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

public class MyMerchanthomeAdapter extends CommonAdapter<MerchantGroupbean> {
    public MyMerchanthomeAdapter(Context context, int layoutId, List<MerchantGroupbean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, MerchantGroupbean setBean, int position) {
        //设置图标
        CircleImageView imageView = holder.getView(R.id.service_icon);
        Glide.with(mContext).load(Constants.APP_IP +((mContext instanceof MainActivity)?setBean.img: setBean.icon)).placeholder(R.drawable.no_banner).dontAnimate().into(imageView);
        //设置名称
        holder.setText(R.id.service_name,((mContext instanceof MainActivity)?setBean.cat_name: setBean.name));
    }
}
